﻿@{
    ViewBag.Title = "访问被拒绝";
}

<div class="container" style="margin-top: 20px;">
    <blockquote>
        <h1>访问被拒绝! 可能的原因有：</h1>
        <div class="alert alert-info">
            <p>
                1. 您还没有登录
            </p>
            <p>
                2. 您的账号权限不足
            </p>
            <p>
                3. 您的帐号在其他的地方登录，您被迫下线
            </p>
        </div>
    </blockquote>
    <div class="alert">
        <p>
            <a href="/login/login"><<< 登录首页</a>
        </p>
        <p>
            <a href="javascript:history.go(-1);"><<< 返回</a>
        </p>

    </div>
    <div class="alert">
        <form>
            <p>
                <label>
                    帐号:
                    <input type="text" id="userid" value="@(ViewBag.UserName)" />
                </label>
            </p>
            <p>
                <label>
                    密码:
                    <input type="password" id="userpwd" value="" />
                </label>
            </p>
            <p>
                <button id="btn_login" class="btn btn-default">登录</button>
            </p>
        </form>
    </div>
</div>

@section script
{
    <script type="text/javascript">
        $(function () {
            $("#btn_login").click(function () {
                var param = { u: $("#userid").val(), p: $("#userpwd").val(), h: "@(ViewBag.HospitalId)" };

                if (!!!param.u) {
                    alert('请输入用户名');
                    $("#userid").focus();
                    return;
                }
                if (!!!param.p) {
                    alert('请输入密码');
                    $("#userpwd").focus();
                    return;
                }


                $.post("/Login/DoLogin", param, function (msg) {
                    if (msg.flag) {
                        console.log(msg.msg);
                        window.location.href = "/adm/index";

                    } else {
                        alert(msg.msg);
                    }

                });
            });
        });
    </script>
}
